package com.ylxin.smartplatform.utils;

import com.ylxin.smartplatform.pojo.SysUserInfo;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * @author 29048
 * @version V1.0
 * @Project bk2205
 * @Package com.ylxin.smartplatform.utils
 * @Description: Create by 杨立新 @Date 2022/9/16 0:01
 */
public class SecurityUtils {

    /**
     * 获取当前登录的用户
     * @return
     */
    public static SysUserInfo getLoginUser(){
        Object user = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession().getAttribute("user");
        return (SysUserInfo) user;
    }
}
